# Contributor: Laurent Bercot <ska-devel@skarnet.org>
# Maintainer: Laurent Bercot <ska-devel@skarnet.org>
pkgname=dnsfunnel
pkgver=0.0.1.6
pkgrel=0
pkgdesc="A small local DNS cache daemon"
url=https://skarnet.org/software/dnsfunnel/
arch="all"
license="ISC"
options="!check"  # no test targets
makedepends="skalibs-dev>=2.14 s6-dns-dev"
subpackages="$pkgname-doc $pkgname-openrc"
source="https://skarnet.org/software/dnsfunnel/dnsfunnel-$pkgver.tar.gz
	dnsfunnel.initd"
install="dnsfunnel.pre-install"

build() {
	./configure \
		--enable-shared \
		--enable-static \
		--disable-allstatic \
		--prefix=/usr \
		--libdir=/usr/lib \
		--libexecdir="/usr/lib/$pkgname" \
		--with-dynlib=/lib
	make
}

package() {
	make DESTDIR="$pkgdir" install
	install -D "$srcdir/dnsfunnel.initd" "$pkgdir/etc/init.d/dnsfunnel"
}

doc() {
	default_doc
	mkdir -p "$subpkgdir/usr/share/doc"
	cp -a "$builddir/doc" "$subpkgdir/usr/share/doc/$pkgname"
}

sha512sums="
ceecdbf268eca39ffac37d09a7f85fd799aa7fe1b15a83954bfb448f22edc53e84aab2e90d4492d6ddc7d1342e0f5889aa1bd1b16087a7d49c37ee35a8637bdb  dnsfunnel-0.0.1.6.tar.gz
b34242cbf457a26770e87ea36d2d6169a42367e4a04444a48b7cae3688827c61e93aeafbd1d009b19e327db66723e9a7c161c4a0b1e27fa3746ccf1cd29a5d2e  dnsfunnel.initd
"
